<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>欢迎页面-X-admin2.2</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <link rel="stylesheet" href="./css//formSelects-v4.css">
    <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        table,
        tr,
        th,
        td {
            border: rgb(83, 129, 255) solid 1px;
            text-align: center;
        }

        .content {
            width: 900px;
            margin: 0 auto;
        }

        /*input{*/
        /*    width:100px !important;*/
        /*}*/
        .content tr td {
            width: 100px;
        }
    </style>
</head>

<body>
    <div class="layui-fluid">
        <div class="layui-row">
            <form class="layui-form">
                <table cellpadding="0" cellspacing="0" class="content">
                    <tr>
                        <td colspan="7" style="font-size: 16px;height: 50px">用户信息添加表</td>
                    </tr>
                    <tr>
                        <td>
                            <span class="x-red">*</span>用户名
                        </td>
                        <td>
                            <input type="text" name="username" required="" lay-verify="required" class="layui-input">
                        </td>
                        <td>
                            <span class="x-red">*</span>密码
                        </td>
                        <td>
                            <input type="text" name="password" required="" lay-verify="required" class="layui-input">
                        </td>
                        <td>
                            <span class="x-red">*</span>确认密码
                        </td>
                        <td>
                            <input type="text" name="rePassword" required="" lay-verify="rePassword"
                                class="layui-input">
                        </td>
                        <td rowspan="4">
                            <button type="button" class="layui-btn" id="test1">
                                <i class="layui-icon">&#xe67c;</i>上传图片
                            </button>
                            <img class="layui-upload-img" id="demo1">
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <span class="x-red">*</span>姓名
                        </td>
                        <td>
                            <input type="text" name="name" required="" lay-verify="required" class="layui-input">
                        </td>
                        <td>
                            <span class="x-red">*</span>性别
                        </td>
                        <td>
                            <input type="radio" name="sex" value="男" title="男">
                            <input type="radio" name="sex" value="女" title="女" checked>
                        </td>
                        <td>
                            <span class="x-red">*</span>民族
                        </td>
                        <td>
                            <select name="nation" lay-verify="required">
                                <option value=""></option>
                                <option value="0">北京</option>
                                <option value="1">上海</option>
                                <option value="2">广州</option>
                                <option value="3">深圳</option>
                                <option value="4">杭州</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td><span class="x-red">*</span>电话</td>
                        <td>
                            <input type="text" name="phone" required="" lay-verify="phone" class="layui-input">
                        </td>
                        <td><span class="x-red">*</span>邮箱</td>
                        <td>
                            <input type="text" name="email" required="" lay-verify="email" class="layui-input">
                        </td>
                        <td><span class="x-red">*</span>出生年月</td>
                        <td>
                            <input type="text" name="birth" id="date" required="" lay-verify="required"
                                class="layui-input">
                        </td>
                    </tr>
                    <tr>
                        <td><span class="x-red">*</span>籍贯</td>
                        <td>
                            <input type="text" name="native_place" required="" lay-verify="required"
                                class="layui-input">
                        </td>
                        <td><span class="x-red">*</span>政治面貌</td>
                        <td>
                            <select name="faith" lay-verify="required">
                                <option value=""></option>
                                <option value="0">北京</option>
                                <option value="1">上海</option>
                                <option value="2">广州</option>
                                <option value="3">深圳</option>
                                <option value="4">杭州</option>
                            </select>
                        </td>
                        <td><span class="x-red">*</span>毕业时间</td>
                        <td>
                            <input type="text" name="graduate_time" id="graduate_time" required="" lay-verify="required"
                                class="layui-input">
                        </td>
                    </tr>
                    <tr>
                        <td><span class="x-red">*</span>身份证号码</td>
                        <td colspan="2">
                            <input type="text" name="id_card" required="" lay-verify="id_card" class="layui-input">
                        </td>
                        <td><span class="x-red">*</span>地址</td>
                        <td colspan="3">
                            <input type="text" name="address" required="" lay-verify="required" class="layui-input">
                        </td>
                    </tr>
                    <tr>
                        <td><span class="x-red">*</span>加入工作时间</td>
                        <td><input type="text" name="job_date" id="job_date" required="" lay-verify="required"
                                class="layui-input"></td>
                        <td><span class="x-red">*</span>调入本校时间</td>
                        <td><input type="text" name="stos_date" id="stos_date" required="" lay-verify="required"
                                class="layui-input"></td>
                        <td><span class="x-red">*</span>毕业院校</td>
                        <td colspan="2">
                            <select name="school" lay-verify="required">
                                <option value=""></option>
                                <option value="0">北京</option>
                                <option value="1">上海</option>
                                <option value="2">广州</option>
                                <option value="3">深圳</option>
                                <option value="4">杭州</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td><span class="x-red">*</span>学历类型</td>
                        <td>
                            <select name="education_type" lay-verify="required">
                                <option value=""></option>
                                <option value="0">北京</option>
                                <option value="1">上海</option>
                                <option value="2">广州</option>
                                <option value="3">深圳</option>
                                <option value="4">杭州</option>
                            </select>
                        </td>
                        <td><span class="x-red">*</span>学位</td>
                        <td><input type="text" name="degree" required="" lay-verify="required" class="layui-input"></td>
                        <td><span class="x-red">*</span>专业</td>
                        <td colspan="2">
                            <select name="major" lay-verify="required">
                                <option value=""></option>
                                <option value="0">北京</option>
                                <option value="1">上海</option>
                                <option value="2">广州</option>
                                <option value="3">深圳</option>
                                <option value="4">杭州</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td><span class="x-red">*</span>现学历</td>
                        <td colspan="3">
                            <select name="education" lay-verify="required">
                                <option value=""></option>
                                <option value="0">北京</option>
                                <option value="1">上海</option>
                                <option value="2">广州</option>
                                <option value="3">深圳</option>
                                <option value="4">杭州</option>
                            </select>
                        </td>
                        <td><span class="x-red">*</span>系列名称</td>
                        <td colspan="2"><input type="text" name="series_name" required="" lay-verify="required" class="layui-input">
                        </td>

                    </tr>
                    <tr>
                        <td><span class="x-red">*</span>专业技术岗位</td>
                        <td colspan="6">
                            <select name="patp" xm-select="patp">
                                <option value="1">北京</option>
                                <option value="2">上海</option>
                                <option value="3">广州</option>
                                <option value="4">深圳</option>
                                <option value="5">天津</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td><span class="x-red">*</span>专业技术服务</td>
                        <td colspan="6">
                            <select name="city" xm-select="select2">
                                <option value="1">北京</option>
                                <option value="2">上海</option>
                                <option value="3">广州</option>
                                <option value="4">深圳</option>
                                <option value="5">天津</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td><span class="x-red">*</span>取得职务时间</td>
                        <td><input type="text" name="title_time" id="title_time" required="" lay-verify="title_time"
                                class="layui-input">
                        </td>
                        <td><span class="x-red">*</span>任教阶段</td>
                        <td><input type="text" name="teach_page" required="" lay-verify="teach_page"
                                class="layui-input">
                        </td>
                        <td><span class="x-red">*</span>现任教学科</td>
                        <td colspan="2">
                            <select name="current_subject" lay-verify="required current_subject">
                                <option value=""></option>
                                <option value="0">北京</option>
                                <option value="1">上海</option>
                                <option value="2">广州</option>
                                <option value="3">深圳</option>
                                <option value="4">杭州</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td><span class="x-red">*</span>校区</td>
                        <td colspan="2">
                            <select name="campus" lay-verify="required campus">
                                <option value=""></option>
                                <option value="0">北京</option>
                                <option value="1">上海</option>
                                <option value="2">广州</option>
                                <option value="3">深圳</option>
                                <option value="4">杭州</option>
                            </select>
                        </td>
                        <td colspan="2"><span class="x-red">*</span>部门名称</td>
                        <td colspan="2">
                            <select name="dept" lay-verify="required dept">
                                <option value=""></option>
                                <option value="0">北京</option>
                                <option value="1">上海</option>
                                <option value="2">广州</option>
                                <option value="3">深圳</option>
                                <option value="4">杭州</option>
                            </select>
                        </td>

                    </tr>
                    <tr>
                        <td><span class="x-red">*</span>荣誉称号</td>
                        <td colspan="6">
                            <select name="city" xm-select="select1">
                                <option value="1">北京</option>
                                <option value="2">上海</option>
                                <option value="3">广州</option>
                                <option value="4">深圳</option>
                                <option value="5">天津</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td><span class="x-red">*</span>是否专任教师</td>
                        <td>
                            <input type="radio" name="is_class" value="1" title="是">
                            <input type="radio" name="is_class" value="0" title="否" checked>
                        </td>
                        <td colspan="2"><span class="x-red">*</span>是否编制人员</td>
                        <td>
                            <input type="radio" name="is_organ" value="1" title="是">
                            <input type="radio" name="is_organ" value="0" title="否" checked>
                        </td>
                        <td><span class="x-red">*</span>是否停用</td>
                        <td>
                            <input type="radio" name="is_stop" value="1" title="是">
                            <input type="radio" name="is_stop" value="0" title="否" checked>
                        </td>
                    </tr>
                    <tr style="height: 100px">
                        <td rowspan="2">角色</td>
                        <td colspan="6" rowspan="2" style="text-align: left">
                            <div class="layui-input-block">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                                <input name="id[]" lay-skin="primary" type="checkbox" title="1" value="1">
                            </div>
                        </td>
                    </tr>
                    <tr></tr>
                    <tr>
                        <td colspan="7" style="height: 40px">
                            <button class="layui-btn" lay-submit="" lay-filter="add">立即提交</button>
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
    <script>
        //全局定义一次, 加载formSelects
        layui.config({
            base: './js/' //此处路径请自行处理, 可以使用绝对路径
        }).extend({
            formSelects: 'formSelects-v4'
        });
        layui.use(['form', 'layer', 'laydate', 'upload', 'formSelects'], function () {
            $ = layui.jquery;
            var form = layui.form,
                layer = layui.layer;
            var laydate = layui.laydate;
            var upload = layui.upload;
            var formSelects = layui.formSelects;
            laydate.render({
                elem: '#date'
            });
            laydate.render({
                elem: '#graduate_time'
            });
            laydate.render({
                elem: '#job_date'
            });
            laydate.render({
                elem: '#stos_date'
            });
            laydate.render({
                elem: '#title_time'
            });

            //图片上传
            upload.render({
                elem: '#test1'
                , url: ''
                , done: function (res) {
                    //上传完毕回调
                }
                , error: function () {
                    //请求异常回调
                }
            });
            //自定义验证规则
            form.verify({
                rePassword: function (value) {
                    console.log(value);
                    console.log($('input[name="password"]').val());
                    if (value.length < 1) {
                        return '密码不能为空！'
                    } else if (value != $('input[name="password"]').val()) {
                        return '两次密码不一致！'
                    }
                },
                id_card: function (value) {
                    console.log(value);
                    var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;
                    if (value.length < 1) {
                        return '身份证不能为空！'
                    } else if (reg.test(value) === false) {
                        return '身份证格式不对！';
                    }
                }
            });

            //监听提交
            form.on('submit(add)',
                function (data) {
                    console.log(data);
                    //发异步，把数据提交给php
                    layer.alert("增加成功", {
                        icon: 6
                    },
                        function () {
                            //关闭当前frame
                            xadmin.close();

                            // 可以对父窗口进行刷新
                            xadmin.father_reload();
                        });
                    return false;
                });

        });
    </script>

</body>

</html>
